﻿/// Write a method that returns the index of the first element in array that is bigger than its neighbors, or -1, 
/// if there’s no such element. Use the method from the previous exercise.

using System;

namespace c_sh_II_lek_3
{
    class Zad7
    {
        static void Main()
        {
            int number = 10;

            Console.WriteLine(ReverseNumber(number));
        }

        static int ReverseNumber(int number)
        {
            int reversed = 0;
            int temp = number;
            int counrt = 0;

            while (number >= 10)
            {
                temp = number % 10;
                number = number / 10;
                reversed += temp * (int)Math.Pow(10, number.ToString().Length);
                counrt++;
            }
            if (counrt>0)
            {
                return reversed + number;
            }
            else
            {
                return number;
            }
            
        }
       
    }
}
